<?php
		require("../dbconnect.php");
		require("../function.php");

		
		$value=$_GET["value"];
		
		
		
		$check_voucher=checkDiscountVoucher(trim($value));
		
		if($check_voucher!=1)
		{
			echo discountVoucherErrorMsg($check_voucher);
		}
		else
		{
			$get=mysql_query("select * from os_discount_voucher where voucher_code='$value'")or die(mysql_error());
		
			$v=mysql_fetch_array($get,MYSQL_ASSOC);
			
			if($v['discount_type']=="P")
			{
				$desc=number_format($v['discount_amount'],0)."% off";
			}
			else
			{
				$desc=" RM".$v['discount_amount']." off";
			}
			
			echo "<div class='dw_success'>$desc (".$v['voucher_name'].")</div>";	
		}
		
?>